package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	Mysql
	Redis
	Es
	OSS
	QiNiu
}
type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}

type Redis struct {
	Host     string
	Port     string
	Password string
	Database int
}
type Es struct {
	Address string
}

type OSS struct {
	AccessKeyID     string
	AccessKeySecret string
	Endpoint        string
	Bucket          string
}

type QiNiu struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Url       string
}

var Config AppConfig

func InitConfig() {

	viper.SetConfigFile("../config/config.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Config)
	fmt.Println("配置文件读取成功")
}
